﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Common/Main.Master" AutoEventWireup="true"
    CodeBehind="ContractManage.aspx.cs" Inherits="ATW.MT.SellManage.ContractManage" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cp01" runat="server">
    <div class="main_hd">
        <h2 style="padding: 0px 20px;">
            合同管理
        </h2>
        <div class="title_tab" id="topTab">
            <ul>
                <li>合同归属：&nbsp;<input type="text" id="txtName" runat="server" />
                &nbsp;采购标题：&nbsp;<input type="text" id="txtTitle" runat="server" />
                &nbsp; 类型：&nbsp;
                    <asp:DropDownList runat="server" ID="ddlType">
                        <asp:ListItem Text="全部" Value=""></asp:ListItem>
                        <asp:ListItem Text="采购合同" Value="1"></asp:ListItem>
                        <asp:ListItem Text="销售合同" Value="2"></asp:ListItem>
                    </asp:DropDownList>
                    &nbsp;状态 ：&nbsp;<asp:DropDownList runat="server" ID="ddlStatus">
                        <asp:ListItem Text="全部" Value=""></asp:ListItem>
                        <asp:ListItem Text="未确认" Value="0"></asp:ListItem>
                        <asp:ListItem Text="已确认" Value="1"></asp:ListItem>
                        <asp:ListItem Text="删除" Value="2"></asp:ListItem>
                        <asp:ListItem Text="待处理" Value="3"></asp:ListItem>
                    </asp:DropDownList>
                    &nbsp;
                    <asp:Button runat="server" ID="btnSearch" Text="搜索" class="MaintenanceButton" OnClick="btnSearch_Click"
                        Style="background: #d91913; outline: none; border: none; color: White; padding: 5px 20px;" />
                    &nbsp; &nbsp; &nbsp; </li>
                <li style="margin-top: 10px">发布时间：&nbsp;<input id="txtPubStart" runat="server" class="Wdate"
                    type="text" onfocus="var p_next=getDate('txtPubEnd');WdatePicker({skin:'whyGreen',maxDate:p_next||'%y-%M-%d'})" />&nbsp;
                    &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;至&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
                    <input id="txtPubEnd" class="Wdate" runat="server" type="text" onfocus="var p_prv=getDate('txtPunStart'); WdatePicker({skin:'whyGreen',minDate:p_prv,maxDate:'%y-%M-%d'})" />
                    &nbsp;&nbsp; </li>
            </ul>
            <ul>
                <li>
                    <asp:Label runat="server" ID="lblError" ForeColor="Red" Font-Bold="true"></asp:Label></li>
            </ul>
        </div>
        <asp:Repeater ID="rpList" runat="server">
            <HeaderTemplate>
                <table width="95%" border="0" cellpadding="0" cellspacing="0" style="font-size: 14px"
                    class="queryResultTable">
                    <tr>
                        <th>
                            合同类型
                        </th>
                        <th>
                            采购标题
                        </th>
                        <th>
                            归属人
                        </th>
                        <th>
                            合同内容
                        </th>
                        <th>
                            签署时间
                        </th>
                        <th>
                            状态
                        </th>
                        <th>
                            异常
                        </th>
                        <th>
                            操作
                        </th>
                    </tr>
            </HeaderTemplate>
            <ItemTemplate>
                <tr>
                    <td>
                        <%#Eval("type").ToString() == "1" ? "采购合同" : Eval("type").ToString() == "2" ? "销售合同" : "未知"%>
                    </td>
                    <td>
                        <%#Eval("title").ToString() %>
                    </td>
                    <td>
                        <%#Eval("name").ToString() %>
                    </td>
                    <td>
                        <asp:LinkButton runat="server" ID="lbnContractDetail" OnClick="lbnContractDetail_Click"
                            CommandArgument='<%#Eval("ContractID").ToString() %>'>
                            查看详情
                        </asp:LinkButton>
                    </td>
                    <td>
                        <%#Eval("create_time").ToString()%>
                    </td>
                    <td>
                        <%#Eval("rowstatus").ToString()=="0"?"已发送":
                            Eval("rowstatus").ToString()=="1"?"已确认":
                             Eval("rowstatus").ToString()=="2"?"已删除":
                             Eval("rowstatus").ToString()=="3"?"待处理":""%>
                    </td>
                    <td>
                        <asp:LinkButton runat="server" ID="lbnShowExList" OnClick="lbnShowEx_Click" Enabled='<%#Eval("exnum").ToString()=="0"?false:true %>'
                            CommandArgument='<%#Eval("ContractID").ToString() %>'>
                            <%#Eval("exnum").ToString() %>
                        </asp:LinkButton>
                    </td>
                    <td>
                        <asp:LinkButton runat="server" ID="lbnPush" OnClick="lbnPush_Click" Visible='<%#Eval("rowstatus").ToString()=="3"?true:false %>'
                            CommandArgument='<%#Eval("RequestID").ToString() %>' OnClientClick="divNote.Show()">
                            生成供应商合同</asp:LinkButton>
                        <asp:LinkButton runat="server" ID="lbnAddEx" CommandArgument='<%#Eval("ContractID").ToString() %>'
                            OnClick="lbnAddEx_Click" Visible='<%#Eval("Ostatus").ToString()=="4"?true:false%>'>登记异常</asp:LinkButton>
                        <asp:LinkButton runat="server" ID="lbnConfirm" OnClick="lbnConfirm_Click" OnClientClick="return confirm('该合同状态将被设为在执行合同，请确认。')"
                            CommandArgument='<%#Eval("OID").ToString() %>' Visible='<%#Eval("rowstatus").ToString()=="1"? Eval("Ostatus").ToString()=="3"?true:false:false %>'>
                            执行合同
                        </asp:LinkButton>
                        <asp:HiddenField runat="server" ID="hdfType" Value='<%#Eval("type").ToString() %>' />
                    </td>
                </tr>
            </ItemTemplate>
            <FooterTemplate>
                </table>
            </FooterTemplate>
        </asp:Repeater>
        <cc1:AspNetPager ID="AspNetPager1" Style="float: right" runat="server" PageSize="10"
            AlwaysShow="true" CssClass="paginator" CurrentPageButtonClass="cpb" FirstPageText="首页"
            PagingButtonSpacing="0" LastPageText="尾页" NextPageText="下一页" PrevPageText="上一页"
            OnPageChanged="AspNetPager1_pageChanged">
        </cc1:AspNetPager>
    </div>
    <div id="divNote" style="display: none;">
        <div class="tc_header">
            <h2>
                提示</h2>
            <a id="A1">
                <img src="../images/chacha.png" width="13" height="13"></a>
        </div>
        <div class="tc_content">
            <div class="tanchu03" style="min-width: 200px,min-height:80px">
                <p id="P1">
                    正在生成合同，请稍后。。
                </p>
            </div>
        </div>
    </div>
    <div id="divMsg" style="display: none;">
        <div class="tc_header">
            <h2>
                提示</h2>
            <a id="hideMsg">
                <img src="../images/chacha.png" width="13" height="13"></a>
        </div>
        <div class="tc_content">
            <div class="tanchu03" style="min-width: 200px,min-height:80px">
                <p id="msgContent">
                </p>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        function getDate(o) {
            var obj = $('[id$=' + o + ']').get(0);
            return $(obj).val()
        }
        var divNote = new jSharp.popUpDiv('divNote');
    </script>
</asp:Content>
